home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / ola-2p.tip < prev    next >
Text File  |  1993-09-15  |  3KB  |  122 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 36.2.4, p. IV-141.
  16. % Original source in file "o3.TEX", starting line 444.
  17. \wlog{L: "ola-2p.tip" ["o3.TEX," l. 444, p. IV-141]}%
  18. % This file DOES NOT belong to format "texip."
  19. \InputD{namedef.tip}
  20. \catcode`\@ = 11
  21. \def\FigurePlacementFileName{\jobname.fip }
  22. \newcount\Fco
  23. \newread\FigurePlacementStreamIn
  24. \newwrite\FigurePlacementStreamOut
  25. \def\ReadTheFigurePlacementFile{% 
  26.     \Fco = 1
  27.     \openin\FigurePlacementStreamIn = \FigurePlacementFileName
  28.     \ActuallyReadFigurePlacementFile
  29.     \immediate\openout\FigurePlacementStreamOut =
  30.         \FigurePlacementFileName
  31. }
  32. \def\ActuallyReadFigurePlacementFile{%
  33.     \ifeof\FigurePlacementStreamIn
  34.         \closein\FigurePlacementStreamIn
  35.         \let\ReadInFigurePlacementFileNext = \relax
  36.     \else
  37.         \read\FigurePlacementStreamIn to \ALineFromTheFile
  38.         \def\ParMeansDone{\par}% 
  39.         \ifx\ALineFromTheFile\ParMeansDone
  40.         \else
  41.             \NameEdef{Fig-\the\Fco}{\ALineFromTheFile}
  42.             \advance\Fco by 1
  43.         \fi
  44.         \let\ReadInFigurePlacementFileNext =
  45.                 \ActuallyReadFigurePlacementFile
  46.     \fi
  47.     \ReadInFigurePlacementFileNext
  48. }
  49. \newcount\FBTwoCount
  50. \FBTwoCount = 1
  51. \newif\ifLeftSideCaption
  52. \def\FBTwoPass #1#2#3{% 
  53.     \PrepareFigureBoxes{#1}{#2}{#3}
  54.     \insert\FigureIns{%
  55.         \write\FigurePlacementStreamOut{\the\pageno}
  56.         \if\NameDefinedConditional{Fig-\the\FBTwoCount}% 
  57.             \wlog{Figure \the\FBTwoCount:
  58.                     \NameUse{Fig-\the\FBTwoCount}}%
  59.             \expandafter\ifodd\NameUse{Fig-\the\FBTwoCount}%
  60.                 \LeftSideCaptionfalse
  61.             \else
  62.                 \LeftSideCaptiontrue
  63.             \fi
  64.         \else
  65.             \LeftSideCaptiontrue
  66.         \fi
  67.         \ifLeftSideCaption
  68.             \hbox{%
  69.                 \valign{% 
  70.                     ##\vfil
  71.                 \cr
  72.                     \copy 1\cr
  73.                     \copy 0\cr
  74.                 }%
  75.             }%
  76.         \else
  77.             \hbox{%
  78.                 \valign{% 
  79.                     ##\vfil
  80.                 \cr
  81.                     \copy 0\cr
  82.                     \copy 1\cr
  83.                 }%
  84.             }%
  85.         \fi
  86.     }
  87.     \advance\FBTwoCount by 1
  88. }
  89. \def\OutCaptionGameTwoPass{%
  90.     \setbox0 = \box\voidb@x
  91.     \setbox1 = \box\voidb@x
  92.     \ifodd\pageno
  93.         \dimen0 = 0pt
  94.         \let\Header = \RightHeader
  95.         \let\Footer = \RightFooter
  96.     \else
  97.         \dimen0 = \DiffWidth
  98.         \let\Header = \LeftHeader
  99.         \let\Footer = \LeftFooter
  100.     \fi
  101.     \shipout\vbox{%
  102.         \hrule height 1pt
  103.         \vskip 5pt
  104.         \Header
  105.         \vskip 12pt
  106.         \ifvoid\FigureIns
  107.         \else
  108.             \box\FigureIns
  109.             \vskip\skip\FigureIns
  110.         \fi
  111.         \moveright\dimen0 \BoxR 255
  112.         \vskip 12pt
  113.         \Footer
  114.     }
  115.     \global\advance\pageno by 1
  116.     \ifnum\outputpenalty > -20000
  117.     \else
  118.         \dosupereject
  119.     \fi
  120. }
  121. \catcode`\@ = 12
  122.